package aiku.numericalcontroloa.Controller.ExpenseController;

import aiku.numericalcontroloa.Base.Utils.Result;
import aiku.numericalcontroloa.Model.Dto.ExpenseDto;
import aiku.numericalcontroloa.Model.Entity.Expense;
import aiku.numericalcontroloa.Service.Impl.ExamineServiceImpl;
import aiku.numericalcontroloa.Service.Impl.ExpenseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

/**
 * @author 马文杰
 * @version 1.0
 */
@RestController
@RequestMapping("/expense")
public class ExpenseController {
    @Autowired
    private ExpenseServiceImpl expenseService;
    /**
     * 员工添加报销记录
     */
    @PostMapping("/addExpense")
    public Result addExpense(@RequestBody ExpenseDto expenseDto) {
        return expenseService.addExpense(expenseDto);
    }

    /**
     * 管理审核报销记录
     */
    @PostMapping("/expenseUpdate")
    public Result examineUpdate(@RequestParam("id") String id,@RequestParam("status") Integer status){
        return expenseService.examineUpdate(id,status);
    }

    /**
     * 管理查询报销记录
     */
    @PostMapping("/expenseList")
    public Result examineList(){
        return expenseService.examineList();
    }

    /**
     * 分页查询报销记录
     * @param expenseDto
     * @return
     */
    @PostMapping("/getExpenseList")
    public Result getExpenseList(@RequestBody ExpenseDto expenseDto){
        return expenseService.getExpenseList(expenseDto);
    }

    /**
     * 获取单个报销单
     * @param expenseDto
     * @return
     */
    @PostMapping("/getExpense")
    public Result getExpense(@RequestBody ExpenseDto expenseDto){
        return expenseService.getExpense(expenseDto);
    }

    /**
     * 修改报销单
     * @param expenseDto
     * @return
     */
    @PostMapping("/updateExpense")
    public Result updateExpense(@RequestBody ExpenseDto expenseDto){
        return expenseService.updateExpense(expenseDto);
    }

    /**
     * 审核
     * @param expenseDto
     * @return
     */
    @PostMapping("/examineExpense")
    public Result examineExpense(@RequestBody ExpenseDto expenseDto){
        return expenseService.examineExpense(expenseDto);
    }
}
